#ifndef _RADIAN_EDITOR_MAIN_WND_H_
#define _RADIAN_EDITOR_MAIN_WND_H_

#include "RadianCommon.h"
#include "ui_RadianMain.h"
#include <QtGui/QMainWindow>
#include "OgreSingleton.h"
#include "RadianResourceBrowser.h"


/* Main Editor Class.
*/
const static float G_Editor_TickTime = 33.0f;// Editor tick time.
class RadianEditor : public QMainWindow, public Ui::MainWindow, public Ogre::Singleton<RadianEditor>
{
	Q_OBJECT
public:
	RadianEditor();
	virtual ~RadianEditor();

protected:
	void closeEvent(QCloseEvent *event);

private slots:
	void newFile();						// new a scene file.
	void open();						// open a scene file.
	bool save();						// save a scene file.
	void about();						// show editor info.
	void displayResourceBrower();		// display the resource view.	
	void switchToRealTimeMode();		// switch to real-time mode.
	
	/* On tick event.
	*/
	void OnTick();


public:
	/* Initialize the editor.
	*/
	void InitEditor();

	QWidget* GetRenderAreaID();

	static RadianEditor* getSingletonPtr();
	static RadianEditor& getSingleton();


	/* Show the editor.
	*/
	void ShowEditor();

private:
	void init();			// init the editor.
	void createActions();	// menu actions set.
	void createMenus();		// create menu.
	void createToolBars();	// create tool bar.
	void createStatusBar(); // create statue bar.
	void loadFile(const QString &fileName);					// load file.
	bool saveFile(const QString &fileName);					// save file.
	QString strippedName(const QString &fullFileName);		// strip name.

	QMenu *fileMenu;
	QMenu *editMenu;
	QMenu *helpMenu;
	QMenu *toolsMenu;
	QToolBar *fileToolBar;
	QToolBar *editToolBar;
	QToolBar *viewToolBar;
	QAction *newAct;
	QAction *openAct;
	QAction *saveAct;
	QAction *closeAct;
	QAction *exitAct;
	QAction *cutAct;
	QAction *copyAct;
	QAction *pasteAct;
	QAction *aboutAct;
	QAction *aboutQtAct;
	QAction *resouceViewAct;
	QAction *realtimeAct;

	RadianMainRenderWnd* m_RadianMainRenderWnd;
	RadianResourceBrowser * m_RadianResourceBrowerWnd;
	QTimer* m_EitorTimer;
};
#endif